import request from '@/utils/request'


// 办公用品领用单 VO
export interface OfficeRequisitionVO {
  userId: number // 领用人
  departmentHeadLeader: string // 部门主管领导
  storeroomKeeper: string // 库房管理员
  purchasingManager: string // 采购员
  purchasingDepartmentHead: string // 采购部门负责人
  remark: string // 备注
  id: number // 办公用品领用id
  processInstanceId: string // 流程编号
  officeRequisitionDetailss?: Array<string>
  startUserSelectAssignees:any
  status: any // 流程状态
  isApproved:any;
}

// 办公用品领用单 API
export const OfficeRequisitionApi = {
  // 查询办公用品领用单分页
  getOfficeRequisitionPage: async (params: any) => {
    return await request.get({ url: `/bpm/office-requisition/page`, params })
  },

  // 查询办公用品领用单详情
  getOfficeRequisition: async (id: number) => {
    return await request.get({ url: `/bpm/office-requisition/get?id=` + id })
  },

  // 新增办公用品领用单
  createOfficeRequisition: async (data: OfficeRequisitionVO) => {
    return await request.post({ url: `/bpm/office-requisition/create`, data })
  },

  // 修改办公用品领用单
  updateOfficeRequisition: async (data: OfficeRequisitionVO) => {
    return await request.put({ url: `/bpm/office-requisition/update`, data })
  },

  // 删除办公用品领用单
  deleteOfficeRequisition: async (id: number) => {
    return await request.delete({ url: `/bpm/office-requisition/delete?id=` + id })
  },

  // 导出办公用品领用单 Excel
  exportOfficeRequisition: async (params) => {
    return await request.download({ url: `/bpm/office-requisition/export-excel`, params })
  },

// ==================== 子表（办公用品领用明细） ====================

  // 获得办公用品领用明细列表
  getOfficeRequisitionDetailsListByOsrId: async (osrId) => {
    return await request.get({ url: `/bpm/office-requisition/office-requisition-details/list-by-osr-id?osrId=` + osrId })
  },
}
